namespace JQuery.WebKit
{
    using System.ComponentModel;
    using System.Security.Permissions;
    using System.Web;
    using System.Web.UI;

    [TypeConverter(typeof(ExpandableObjectConverter)), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
    public sealed class SearchDialogSettings : IStateManager
    {
        private bool _isTracking;
        private StateBag _viewState = new StateBag();

        void IStateManager.LoadViewState(object state)
        {
            if (state != null)
            {
                ((IStateManager) this.ViewState).LoadViewState(state);
            }
        }

        object IStateManager.SaveViewState()
        {
            return ((IStateManager) this.ViewState).SaveViewState();
        }

        void IStateManager.TrackViewState()
        {
            this._isTracking = true;
            ((IStateManager) this.ViewState).TrackViewState();
        }

        public override string ToString()
        {
            return string.Empty;
        }

        [NotifyParentProperty(true), DefaultValue(true), Category("Appearance"), Description("Determines if the search dialog window should be draggable. Default is true.")]
        public bool Draggable
        {
            get
            {
                object obj2 = this.ViewState["Draggable"];
                return ((obj2 == null) || ((bool) obj2));
            }
            set
            {
                this.ViewState["Draggable"] = value;
            }
        }

        [Description("The text label of the 'Find' button in search dialog. Defaults to current localization settings, setting it will override localization default."), Category("Appearance"), NotifyParentProperty(true), DefaultValue("")]
        public string FindButtonText
        {
            get
            {
                object obj2 = this.ViewState["FindButtonText"];
                if (obj2 == null)
                {
                    return "";
                }
                return (string) obj2;
            }
            set
            {
                this.ViewState["FindButtonText"] = value;
            }
        }

        [Category("Appearance"), DefaultValue(300), NotifyParentProperty(true), Description("The height of the search dialog. Default is 300. Accepts only integer numbers.")]
        public int Height
        {
            get
            {
                object obj2 = this.ViewState["Height"];
                if (obj2 == null)
                {
                    return 300;
                }
                return (int) obj2;
            }
            set
            {
                this.ViewState["Height"] = value;
            }
        }

        [NotifyParentProperty(true), Description("The left (X) offset of the dialog window, relative to the grid upper left corner. Accepts negative values. "), DefaultValue(0), Category("Appearance")]
        public int LeftOffset
        {
            get
            {
                object obj2 = this.ViewState["LeftOffset"];
                if (obj2 == null)
                {
                    return 0;
                }
                return (int) obj2;
            }
            set
            {
                this.ViewState["LeftOffset"] = value;
            }
        }

        [DefaultValue(false), Category("Appearance"), Description("Determines if the search dialog should be modal or not. Default is false."), NotifyParentProperty(true)]
        public bool Modal
        {
            get
            {
                object obj2 = this.ViewState["Modal"];
                if (obj2 == null)
                {
                    return false;
                }
                return (bool) obj2;
            }
            set
            {
                this.ViewState["Modal"] = value;
            }
        }

        [DefaultValue(false), NotifyParentProperty(true), Category("Appearance"), Description("Sets multiple search mode on. Multiple search adds the ability to search based on multiple criteria.")]
        public bool MultipleSearch
        {
            get
            {
                object obj2 = this.ViewState["MultipleSearch"];
                if (obj2 == null)
                {
                    return false;
                }
                return (bool) obj2;
            }
            set
            {
                this.ViewState["MultipleSearch"] = value;
            }
        }

        [Description("The text label of the 'Reset' button in search dialog. Defaults to current localization settings, setting it will override localization default."), NotifyParentProperty(true), DefaultValue(""), Category("Appearance")]
        public string ResetButtonText
        {
            get
            {
                object obj2 = this.ViewState["ResetButtonText"];
                if (obj2 == null)
                {
                    return "";
                }
                return (string) obj2;
            }
            set
            {
                this.ViewState["ResetButtonText"] = value;
            }
        }

        [Description("Gets or sets a boolean property controlling if the search dialog window is resizable."), NotifyParentProperty(true), DefaultValue(true), Category("Appearance")]
        public bool Resizable
        {
            get
            {
                object obj2 = this.ViewState["Resizable"];
                return ((obj2 == null) || ((bool) obj2));
            }
            set
            {
                this.ViewState["Resizable"] = value;
            }
        }

        bool IStateManager.IsTrackingViewState
        {
            get
            {
                return this._isTracking;
            }
        }

        [Category("Appearance"), Description("The top (Y) offset of the dialog window, relative to the grid upper left corner. Accepts negative values."), DefaultValue(0), NotifyParentProperty(true)]
        public int TopOffset
        {
            get
            {
                object obj2 = this.ViewState["TopOffset"];
                if (obj2 == null)
                {
                    return 0;
                }
                return (int) obj2;
            }
            set
            {
                this.ViewState["TopOffset"] = value;
            }
        }

        [Category("Appearance"), DefaultValue(false), NotifyParentProperty(true), Description("Determines if validation should be applied to search fields prior to submitting to server.")]
        public bool ValidateInput
        {
            get
            {
                object obj2 = this.ViewState["ValidateInput"];
                if (obj2 == null)
                {
                    return false;
                }
                return (bool) obj2;
            }
            set
            {
                this.ViewState["ValidateInput"] = value;
            }
        }

        private StateBag ViewState
        {
            get
            {
                return this._viewState;
            }
        }

        [NotifyParentProperty(true), Category("Appearance"), Description("The width of the search dialog. Default is 300. Accepts only integer numbers."), DefaultValue(300)]
        public int Width
        {
            get
            {
                object obj2 = this.ViewState["Width"];
                if (obj2 == null)
                {
                    return 300;
                }
                return (int) obj2;
            }
            set
            {
                this.ViewState["Width"] = value;
            }
        }
    }
}

